class User < ApplicationRecord
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :validatable,
         :lockable,
         :jwt_authenticatable,
         jwt_revocation_strategy: JwtBlacklist,
         authentication_keys: [:username]

  validates :username, uniqueness: true, presence: true

  has_many :todos

  extend FriendlyId
  friendly_id :username, use: :slugged

  def email_required?
   false
  end

  def email_changed?
    false
  end

  def admin?
    self.admin
  end

end
